package com.csoa.community.requests;

import java.util.List;

import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.chinaface.JSONArray;
import org.json.chinaface.JSONObject;

import com.csoa.community.bean.TongZhiModel;
import com.csoa.community.net.ErrorMsg;
import com.csoa.community.utils.StringUtils;

public class TongZhiXQRequest extends AbstractRequest {

	public TongZhiModel model;
	
	public TongZhiXQRequest(List<BasicNameValuePair> requestValues) {
		super(method_tongzhi_xq, requestValues);
	}

	@Override
	protected void parseRemaingInfo(String json) throws ErrorMsg, JSONException {
		
		if(!StringUtils.isEmpty(json)) {
			try {
				JSONArray ja = new JSONArray(json);
				if (ja.length() > 0) {
					JSONObject jo = ja.getJSONObject(0);
					model = new TongZhiModel();
					model.id = jo.getString("DocumentID");
					model.zuozhe = jo.getString("Author");
					model.time = jo.getString("PassDateTime");
					model.content = jo.getString("Content");
					model.name = jo.getString("Title");
				}
			} catch (org.json.chinaface.JSONException e) {
				e.printStackTrace();
			}
		}
		
	}
}
